<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>数组的sort方法</title>
	</head>
	<body>
	</body>
	<script>
		var f=['banana','apple','mango'];
		f.sort();
		console.log(f);
		
		var n=[3,51,21,60,7];
		n.sort(
			function(a,b){
				//返回的是 a-b 升序,返回 b-a 降序
				return b-a;
			}
		)
		console.log(n);
	</script>
</html>
